package com.dq.Week2.day07.poly.tuxing;

/**
 * 矩形
 * 子类
 */
public class Rectangle extends TuXing{

    private double width;  // 宽
    private double height;  // 高

    @Override
    public double zc() {
        super.zc();
        double zc = (width + height) * 2;
        System.out.println(getName()+"周长为"+zc);
        return zc;
    }

    @Override
    public void area() {
        super.area();
        double area = width * height;
        System.out.println(getName()+"面积为"+area);
    }

    public Rectangle() {
    }

    public Rectangle(String name, double width, double height) {
        super(name);
        this.width = width;
        this.height = height;
    }

    public double getWidth() {
        return width;
    }

    public void setWidth(double width) {
        this.width = width;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }
}